<?php
include("../../inc/global.inc");
include("../islogin.php");
$url="inbox.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=10;
if($_GET['del_act']){
@mysql_query("update note set to_is_id='0' where to_id='".$_COOKIE['user_id']."' and id='".$_GET['del_id']."'");
echo "<script>location='".$url."'</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 信箱管理 &gt;&gt; 收信箱</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">收信箱管理</TD>
   </TR>
</TABLE>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C1DCF5">
        <tr>
          <td width="7%" height="30" align="center" bgcolor="#EFF6FF">编号</td>
          <td align="center" bgcolor="#EFF6FF">主题</td>
          <td width="21%" align="center" bgcolor="#EFF6FF">时间</td>
          <td width="9%" align="center" bgcolor="#EFF6FF">是否阅读</td>
          <td width="10%" align="center" bgcolor="#EFF6FF">&nbsp;</td>
        </tr>
		<?php
$sql="select * from note where to_id='".$_COOKIE['user_id']."' and to_is_id='1' order by is_read asc,id desc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
		?>
        <tr>
          <td height="22" align="center" bgcolor="#FFFFFF"><?=$i?></td>
          <td align="left" bgcolor="#FFFFFF" style="padding-left:5px;"><?=mb_substr($row[n_subject],0,35,'utf-8')?>...</td>
          <td align="center" bgcolor="#FFFFFF"><?=date("Y-m-d H:i",strtotime($row[add_time]))?></td>
          <td align="center" bgcolor="#FFFFFF"><?php if($row[is_read]==1){echo "是";}else{echo "<font color='red'>否</font>";}?></td>
          <td align="center" bgcolor="#FFFFFF"><a href="inbox_info.php?id=<?=$row['id']?>">阅读</a>&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
        </tr>
<?php
$i++;
}?>
<?php
$totalrecord=mysql_num_rows(mysql_query("select * from note where to_id='".$_COOKIE['user_id']."' and to_is_id='1'"));
$totalpage=ceil($totalrecord/$maxpage);
if($totalpage>0){
?>
        <tr>
          <td colspan="5" align="center" bgcolor="#FFFFFF" height="18"><script language="javascript">
<!--
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\">«</a> ");
	document.write("<a href=\"" + sUrl + i + "\">上一页</a> ");
	for(i=Math.max(1,iPage-8);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	document.write("<font color='#ff3333'><b>" + iPage + "</b></font> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+8);i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	if(iCount>iPage+8) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\">下一页</a> ");
	document.write("<a href=\"" + sUrl + iCount + "\">»</a> ");
}
showPageLink("<?=$url?>?page=",<?=$thepage?>,<?=$totalpage?>);
//-->
</script></td>
        </tr><?php }?>
      </table>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>
</div>
</body>
</html>
<script language="javascript">
function del(){
if(confirm("确定要删除该信息!"))
return true;
else
return false;
}
</script>
